# 导入模块
import sys
# 窗口配置
from PyQt5.QtWidgets import *
# 图像相关
from PyQt5.QtGui import *
# QtCore相关
from PyQt5.QtCore import *
sys.path.append("../")
from ui.Ui_EnvironmentWidget import Ui_EnvironmentWidget

class MyEnvironmentWidget(QWidget):
    def __init__(self, parent = None):
        super().__init__(parent)

        self.ui = Ui_EnvironmentWidget()
        self.ui.setupUi(self)
        self.init_ui()
        
    def init_ui(self):
        pass
               
    def showTemperature(self, data):
        data += "℃"
        self.ui.temperatureEdit.setText(data)
    
    def showHumidness(self, data):
        data += "%"
        self.ui.humidnessEdit.setText(data)
    
    def showLight(self, data):
        data += "lx"
        self.ui.lightEdit.setText(data)
        
    def showSmoke(self, data):
        data += "ppm"
        self.ui.smokeEdit.setText(data)
        
    def showRain(self, data):
        data += "mm"
        self.ui.rainEdit.setText(data)


if __name__ == '__main__':
    # 创建应用程序
    app = QApplication(sys.argv)

    # 创建窗口
    w = MyEnvironmentWidget()

    # 显示窗口
    w.show()

    # 等待程序结束
    sys.exit(app.exec_())